<?php
if (!defined('FosfoaSystem')) { exit(1);}
class products_descriptionModel extends spModel
{
	var $pk = "products_id"; // 每个唯一的标志，可以称为主键
	var $table = "products_description"; // 数据表的名称
    var $linker = array(
    array('type' => 'hasone', // 关联类型，这里是一对一关联
        'map' => 'detail', // 关联的标识
        'mapkey' => 'products_id', // 本表与对应表关联的字段名
        'fclass' => 'productsModel', // 对应表的类名
        'fkey' => 'products_id', // 对应表中关联的字段名
        'enabled' => true // 启用关联
        ));

    /**
     * 根据条件返回信息列表
     */
    function Products_list_TAG_SEARCH($conditions, $current_page, $page_size)
    {
        $fields2 = "products_id,products_image,alias,master_categories_id,products_date_added,products_price_discounted,products_price";
        $fields1 = "products_id,products_name,products_title,products_seokeywords,products_seodescription,products_description"; //这里限制被关联表的字段
        $order = "products_id desc";
        //$this->linker[0]['field'] = $fields2;
        $this->spLinker()->spPager($current_page, $page_size)->findAll($conditions, $order, $fields1);
        $request['productslist'] = $this->spLinker()->spPager($current_page, $page_size)->findAll($conditions, $order, $fields1);
        $request['pager'] = $this->spLinker()->spPager()->getPager();    
        return $request;
    }
}